﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WickedSick.ClientComponents.Music;
using System.Collections.ObjectModel;

namespace SDB
{
    /// <summary>
    /// Interaction logic for SongPlayerTestWindow.xaml
    /// </summary>
    public partial class SongPlayerTestWindow : Window
    {
        public SongPlayerTestWindow()
        {
            InitializeComponent();
            player.PlayPauseClick += new MediaButtonClickEventHandler(player_PlayPauseClick);
            player.SongManager.MediaChanged += new MediaChangedDelegate(SongManager_MediaChanged);
        }

        void SongManager_MediaChanged(object sender, MediaChangedEventArgs e)
        {
            txtCurrentSong.Text = string.Format("Current Song [{0}]: {1} - {2}", e.NewIndex, e.NewSong.ParentArtist.Name, e.NewSong.Title);
        }

        void player_PlayPauseClick(object sender, MediaButtonClickEventArgs e)
        {
            Artist ar = new Artist();
            ar.ID = 1;
            ar.Name = "Pillar";

            Album a = new Album();
            a.ID = 1;
            a.Name = "Fireproof";
            a.ReleaseDate = new DateTime(2002, 1, 1);

            ar.Albums.Add(a.ID, a);
            a.Parent = ar;

            //Add Songs
            Song cur_song = new Song();
            cur_song.ID = 1;
            cur_song.TrackNumber = 3;
            cur_song.Title = "Echelon";
            cur_song.SongLocation = SongLocations.Archive;
            a.Songs.Add(cur_song.ID, cur_song);
            cur_song.ParentAlbum = a;
            cur_song.ParentArtist = ar;

            player.SongManager.EnqueueSong(cur_song);

            lstPlaylist.ItemsSource = player.SongManager.SongList;

            cur_song = new Song();
            cur_song.ID = 2;
            cur_song.TrackNumber = 4;
            cur_song.Title = "Stay Up";
            cur_song.SongLocation = SongLocations.Archive;
            a.Songs.Add(cur_song.ID, cur_song);
            cur_song.ParentAlbum = a;
            cur_song.ParentArtist = ar;

            player.SongManager.EnqueueSong(cur_song);
        }
    }
}
